<div class="page-title">

    <div class="title-env">
        <h1 class="title">分区列表</h1>
    </div>

    <div class="breadcrumb-env">

        <ol class="breadcrumb bc-1">
            <li>
                <a href="{:url('/')}"><i class="fa-home"></i>Home</a>
            </li>

            <li class="active">

                <strong>District</strong>
            </li>
        </ol>

    </div>

</div>
<!-- Responsive Table -->
<div class="row">
    <div class="col-md-12">

        <div class="panel panel-default">
            <div class="panel-heading">

                <div class="panel-options">


                    <a href="#" data-toggle="panel">
                        <span class="collapse-icon">&ndash;</span>
                        <span class="expand-icon">+</span>
                    </a>

                    <a href="#" data-toggle="reload">
                        <i class="fa-rotate-right"></i>
                    </a>

                    <a href="#" data-toggle="remove">
                        &times;
                    </a>
                </div>
            </div>
            <div class="panel-body">
                <div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk"
                     data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
                    <div class="btn-toolbar">
                        <div class="btn-group focus-btn-group">
                            <a href="{:url('district/add')}">
                                <button class="btn btn-default"><i class="el-pencil"></i> 添加</button>
                            </a>
                        </div>
                    </div>
                    <div style="text-align: center">
                    </div>
                    <div class="table-responsive" data-pattern="priority-columns" data-focus-btn-icon="fa-asterisk"
                     data-sticky-table-header="true" data-add-display-all-btn="true" data-add-focus-btn="true">
                        <table cellspacing="0" class="table table-small-font table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>分区名称</th>
                                <th>编号</th>
                                <th>代理用户</th>
                                <th>分润</th>
                                <th>余额</th>
                                <th>状态</th>
                                <th style="width: 150px">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo.name}</td>
                                <td>{$vo.number}</td>
                                <td>{$vo['username']}</td>
                                <td>{$vo['total_point']}</td>
                                <td>{$vo['balance']}</td>
                                <td>{$vo['status']==1?'可用':'禁用'}</td>
                                <td>
                                    <a href="{:url('edit')}?id={$vo['id']}" title="修改" class="btn-single"><i class="el-edit"></i></a>
                                    <a href="javascript:;" onclick="del('{$vo.id}')" title="删除" class="btn-single"><i class="el-trash-circled"></i></a>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                    {$list->render()}
                </div>

            </div>


        </div>

    </div>


</div>
<script type="text/javascript">
    function del(id) {
        if(id=='') {
            var str = "";
            $("input:checkbox[name='checkname']:checked").each(function () {
                str += $(this).val() + ",";
            });

            if (str == '') {
                return false
            }
        }else{
            var str     =   id
        }
        layer.confirm('您是否删除该数据', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.ajax({
                'type'  :   'post',
                'url'   :   '{:url("district/delete")}',
                'data'  :   {
                    'id'    :   str
                },
                'dataType'  :   'json',
                'success'   :   function (msg)
                {
                    if(msg.code=='1')
                    {
                        layer.msg(msg.msg);
                        window.location.reload();
                    }else{
                        layer.closeAll();
                        layer.msg(msg.msg);
                    }
                },
                'error'     :   function (err)
                {
                    layer.closeAll();
                    layer.msg(err);
                }
            })
        })
    }
</script>